<?php namespace App\Http\Requests;

class ResetPasswordByPhone extends Request
{
    public function authorize()
    {
        return true;
    }

    /**
     * @return array
     */
    public function attributes()
    {
        return [
            'phone'       => '手机号码',
            'verify_code' => '验证码',
            'password'    => '密码',
        ];
    }

    /**
     * @return array
     */
    public function rules()
    {
        return [
            'phone'       => ['required','regex:/1\d{10}/','exists:users,phone'],
            'verify_code' => 'required',
            'password'    => 'required|confirmed|min:6|max:255',
        ];
    }
}